/**
 * Copyright (c) 2015-2017, Henry Yang 杨勇 (gismail@foxmail.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lambkit.module.cms.core.km;

import java.util.Date;

import com.jfinal.plugin.activerecord.IBean;
import com.jfinal.plugin.activerecord.Record;
import com.lambkit.common.service.ServiceKit;
import com.lambkit.module.cms.rpc.api.CmsScoreService;
import com.lambkit.module.cms.rpc.service.impl.CmsScoreServiceImpl;

/**
 * @author yangyong 
 * @website: www.lambkit.com
 * @email: gismail@foxmail.com
 * @date 2020-02-23
 * @version 1.0
 * @since 1.0
 */
@SuppressWarnings("serial")
public class CmsScore extends Record /*implements IBean*/ {
	
	public static CmsScoreService service() {
		return ServiceKit.inject(CmsScoreService.class, CmsScoreServiceImpl.class);
	}
	
	public enum Type {
		article(0), file(1), page(2);//, topic(3), category(4);

		private int value = 0;

		private Type(int value) {
			this.value = value;
		}

		// 手写的从int到enum的转换函数
		public static Type valueOf(int value) {
			switch (value) {
			case 0:
				return article;
			case 1:
				return file;
			case 2:
				return page;
			default:
				return null;
			}
		}
		public int value() {
			return this.value;
		}
	}

	public CmsScore() {
	}
	
	public CmsScore(Record record) {
		setColumns(record);
	}

	public CmsScore(Long userId, Long itemId, Long score, Date date) {
		// TODO Auto-generated constructor stub
		setUserId(userId);
		setItemId(itemId);
		setScore(score);
		setTime(date);
	}

	public java.lang.Long getUserId() {
		return this.get("user_id");
	}

	public void setUserId(java.lang.Long userId) {
		this.set("user_id", userId);
	}
	public java.lang.Long getItemId() {
		return this.get("item_id");
	}

	public void setItemId(java.lang.Long itemId) {
		this.set("item_id", itemId);
	}
	public java.lang.Long getScore() {
		return this.get("score");
	}

	public void setScore(java.lang.Long score) {
		this.set("score", score);
	}
	public java.util.Date getTime() {
		return this.get("time");
	}

	public void setTime(java.util.Date time) {
		this.set("time", time);
	}
}
